package com.ruoyi.inspection.service.impl;

import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.inspection.domain.GovernCheckTaskItemScore;
import com.ruoyi.inspection.mapper.GovernCheckTaskItemScoreMapper;
import com.ruoyi.inspection.service.GovernCheckTaskItemScoreService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 政府下发专项任务检查项细则表(GovernCheckTaskItemScore)表服务实现类
 *
 * @author makejava
 * @since 2024-06-18 10:49:03
 */
@Service("governCheckTaskItemScoreService")
public class GovernCheckTaskItemScoreServiceImpl implements GovernCheckTaskItemScoreService {
    @Resource
    private GovernCheckTaskItemScoreMapper governCheckTaskItemScoreMapper;

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public GovernCheckTaskItemScore queryById(Long id) {
        return this.governCheckTaskItemScoreMapper.queryById(id);
    }

    /**
     * 通过任务子项ID查询单条数据
     *
     * @param governCheckTaskItemId 任务子项ID
     * @return 实例对象
     */
    @Override
    public List<GovernCheckTaskItemScore> selectByGovernCheckTaskItemId(String governCheckTaskItemId) {
        GovernCheckTaskItemScore governCheckTaskItemScore = new GovernCheckTaskItemScore();
        governCheckTaskItemScore.setGovernCheckTaskItemId(governCheckTaskItemId);
        return queryByPage(governCheckTaskItemScore);
    }

    /**
     * 分页查询
     *
     * @param governCheckTaskItemScore 筛选条件
     * @return 查询结果
     */
    @Override
    public List<GovernCheckTaskItemScore> queryByPage(GovernCheckTaskItemScore governCheckTaskItemScore) {
        return this.governCheckTaskItemScoreMapper.queryAllByLimit(governCheckTaskItemScore);
    }

    /**
     * 新增数据
     *
     * @param governCheckTaskItemScore 实例对象
     * @return 实例对象
     */
    @Override
    public GovernCheckTaskItemScore insert(GovernCheckTaskItemScore governCheckTaskItemScore) {
        this.governCheckTaskItemScoreMapper.insert(governCheckTaskItemScore);
        return governCheckTaskItemScore;
    }

    /**
     * 修改数据
     *
     * @param governCheckTaskItemScore 实例对象
     * @return 实例对象
     */
    @Override
    public GovernCheckTaskItemScore update(GovernCheckTaskItemScore governCheckTaskItemScore) {
        this.governCheckTaskItemScoreMapper.update(governCheckTaskItemScore);
        return this.queryById(governCheckTaskItemScore.getId());
    }

    /**
     * 通过主键删除数据
     *
     * @param id 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Long id) {
        return this.governCheckTaskItemScoreMapper.deleteById(id) > 0;
    }
}
